# coding: utf8


def swap_value(x, y):
    x, y = y, x
    print('x =', x, 'y =', y)


def swap_list(x, y):
    x[0], y[0] = y[0], x[0]


def modify_dict(x):
    x['new'] = 200


def test_params_delivery():
    a, b = 100, 200
    print(
        f" >>> a, b = 100, 200\n"
        f" >>> swap(a, b)\n"
        f"{swap_value(a, b)}\n"
        f" >>> a, b\n"
        f"{a, b}\n"
    )

    a, b = [100], [200]
    print(
        f"# 向函数传递列表对象\n"
        f" >>> a, b = [100], [200]\n"
        f" >>> swap_list(a, b)\n"
        f"{swap_list(a, b)}\n"
        f" >>> print(a, b)\n"
        f"{a}, {b}\n"
    )

    d = {'old': 100}
    print(
        "# 向函数传递字典对象\n"
        " >>> d = {'old': 100}\n"
        " >>> modify_dict(d)\n"
        f"{modify_dict(d)}\n"
        " >>> d\n"
        f"{d}"
    )


def fun(a=[1, 2]):
    pass
